import 'package:flutter/material.dart';
import 'package:junyeyishu/ui/mine/widget/QGMineTradeOrderCell.dart';
import 'package:junyeyishu/utils/utils.dart';

import 'QGMineOrderPage.dart';

class QGMineBatchOrderPage extends QGMineOrderPage {
  const QGMineBatchOrderPage({super.key});
  @override
  State<QGMineOrderPage> createState() => QGMineBatchOrderPageState();
}

class QGMineBatchOrderPageState extends QGMineOrderPageState {
  @override
  void initState() {
    myBought_url = url_market_batchOrderList;

    super.initState();
    items = ["已买入", "待支付", "进行中", "已取消"];
    title = "批量订单";
  }

  @override
  listParam() {
    switch (type) {
      case 0:
        return {"tab_id": 6};
      case 1:
        return {"tab_id": 1};
      case 2:
        return {"tab_id": 4};
      case 3:
        return {"tab_id": 2};
      default:
        break;
    }

    return {};
  }

  @override
  itemBuilder(context, index, data) {
    data ??= {};
    data["status"] = type;
    data["tab"] = 2;

    return GestureDetector(
        onTap: () {
          Navigator.of(context)
              .pushNamed(PageMyOrderDetail, arguments: data)
              .then((value) {
            onRefresh();
          });
        },
        child: QGMineTradeOrderCell(data: data));
  }
}
